﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTEngine
{
    public class Prone : Condition
    {
        //constructor
        public Prone()
        {
            ConditionName = "Prone";
        }

        //clone
        public override Condition Clone()
        {
            return new Prone();
        }

        //cannot move
        public override int ProcessSpeed(int speed)
        {
            return 0;
        }

        //rise and fall
        public override void ConditionAdded(Actor actor)
        {
            base.ConditionAdded(actor);
            actor.Level.Host.ActorProne(actor);
            actor.Level.Host.DisplayMessage(actor.DisplayName + " falls down!", actor);
        }
        public override void ConditionRemoved(Actor actor)
        {
            base.ConditionRemoved(actor);
            actor.Level.Host.ActorRises(actor);
            actor.Level.Host.DisplayMessage(actor.DisplayName + " gets up.", actor);
        }

        //give them a chance to get up
        public override void ProcessImpulse()
        {
            if (Actor.PerformTest(Abilities.Dexterity, 3, 10))
                Actor.RemoveCondition("Prone");
        }
    }
}
